@extends('template.adminpage')
@section('content')
 
<ol class="breadcrumb">
  <li class="active">Canceled order</li>
</ol>

<div class="container-black">
  <label style="margin-top:10px"><u>Pencarian</u></label>
  	<form action="{{URL::to('/order/canceledorders')}}" method="POST">
      <div class="row">
      <div class="col-md-8">
        <div class="col-md-1">
          <input name="filter" value="date" type="radio" <?php if(Session::get('filter')=="date") echo "checked" ?> required ></input>
        </div>
        <div class="col-lg-2">
        <label>Tanggal</label>
        </div>
        <div class="col-lg-4">
          <div class="form-group">
                <div class='input-group date' id='datetimepicker1'>
                    <input type='text' class="form-control" name="datestart" style="height:30px" value="{{Session::get('datestart')}}" />
                    <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span>
                    </span>
                </div>
            </div>
        <script type="text/javascript">
            $(function () {
                $('#datetimepicker1').datetimepicker({
                    pickTime: false
                });
            });
        </script>
        </div>
        <div class="col-lg-1">
        <label>s/d</label>
        </div>
         <div class="col-lg-4">
           <div class="form-group">
                <div class='input-group date' id='datetimepicker2'>
                    <input type='text' class="form-control" name="dateend" style="height:30px" value="{{Session::get('dateend')}}" />
                    <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span>
                    </span>
                </div>
            </div>
        <script type="text/javascript">
            $(function () {
                $('#datetimepicker2').datetimepicker({
                    pickTime: false
                });
            });
        </script>
        </div>
        </div>
        <div class="col-md-3">
         <select  class="form-control" name="dateby" style="height:30px" />
             <?php
            $type = array('all'=>'All','dateorder' => 'Tanggal order', 'ordercanceled' => 'Tanggal canceled');
            foreach ($type as $key => $val) {
                if ($key == Session::get('dateby')) {
                    echo '<option value="' . $key . '" selected>' . $val . '</option>';
                } else {
                    echo '<option value="' . $key . '">' . $val . '</option>';
                }
            }
            ?>
          </select>
         </div>
      </div>

      <div class="row">
      <div class="col-md-8">
        <div class="col-md-1">
          <input name="filter" value="type" type="radio" <?php if(Session::get('filter')=="type") echo "checked" ?>></input>
        </div>
        <div class="col-lg-2">
        <label>Jenis order</label>
        </div>
        <div class="col-lg-4">
           <select  class="form-control" name="typeby" style="height:30px" />
              <?php
            $type = array('all'=>'All','idcard' => 'ID Card', 'packaging' => 'Packaging', 'brochure' => 'Brosur', 'tshirt' => 'Kaos', 'nota' => 'Nota');
            foreach ($type as $key => $val) {
                if ($key == Session::get('list')) {
                    echo '<option value="' . $key . '" selected>' . $val . '</option>';
                } else {
                    echo '<option value="' . $key . '">' . $val . '</option>';
                }
            }
            ?>
          </select>
        </div>
      </div>
      </div>
      <br>


      <div class="row">
      <div class="col-md-8">
        <div class="col-md-1">
          <input name="filter" value="keyword" type="radio" <?php if(Session::get('filter')=="keyword") echo "checked" ?>></input>
        </div>
        <div class="col-lg-2">
        <label>Kata kunci</label>
        </div>
        <div class="col-lg-4">
          <input type="text"  class="form-control" placeholder="Kata kunci" name="keyword" style="height:30px" value="{{Session::get('keyword')}}"  /></input>
        </div>
        <div class="col-lg-4 col-md-offset-1">
          <select name="filterby" class="form-control" style="height:30px"  />
             <?php
            $type = array('code' => 'Kode order', 'name' => 'Nama pemesan');
            foreach ($type as $key => $val) {
                if ($key == Session::get('filterby')) {
                    echo '<option value="' . $key . '" selected>' . $val . '</option>';
                } else {
                    echo '<option value="' . $key . '">' . $val . '</option>';
                }
            }
            ?>
          </select>
        </div>
      </div>
      </div>
      <br>
      <div class="row">
      <div class="col-md-8">
        <div class="col-md-4 col-md-offset-3">
             <button class="btn btn-sm btn-dark" type="submit" style="width:100px;height:30px"><span class="fa fa-search"></span> Tampilkan</button>
        </div>
      </div>
      </div>
        

    </form>
  <label><u>Daftar cancel</u></label>
    <br>

     <form action="{{URL::to('/order/canceledorder/cancel')}}"  method="post" >
    <p><a href="#"><button class="btn btn-sm btn-dark" style="height:30px"><span class="fa fa-sign-in"></span> Batalkan pembatalan</button></a></p>
    <div class="table-responsive">
      <?php  
        $limit = 5;
        if(Input::get('page')==0 OR Input::get('page')==1){ 
         $no = 1;
        }
        else{
        $no = ((Input::get('page')-1)*$limit)+1;
        } ?>
     <table class="table table-bordered table-hover">
      <thead>
        <tr>
          <th><input type="checkbox" name="checkall" id="terserah" onclick="check_all('terserah', {{$no}})" ></input></th>
          <th>No</th>
          <th>Kode order</th>
          <th>Jenis order</th>
          <th>History status</th>
          <th>History proses</th>
          <th>History pembayaran</th>
        </tr>
      </thead>
      <tbody>
        
        @foreach($canceledorder as $canceled)
        <?php
        if($canceled->order_name=='idcard'){$ordername = 'ID Card';}
        else if($canceled->order_name=='packaging'){$ordername = 'Packaging';}
        else if($canceled->order_name=='brochure'){$ordername = 'Brosur';}
        else if($canceled->order_name=='nota'){$ordername = 'Nota';}
        else if($canceled->order_name=='tshirt'){$ordername = 'T-Shirt';}
         ?>
         <td ><input type="checkbox" name="{{$canceled->order_id}}" value='1' id="terserah_{{$no}}" ></input></td>
         <td>{{$no}}</td>
         <td width="200px"><div class="row"><div class="col-md-6">{{$canceled->order_code}}</div><div class="col-md-6"><a data-toggle="modal" data-target="#detail{{$canceled->order_id}}" title="Detail"><button class="btn btn-xs btn-dark"><span class="fa fa-file-text-o"></span> Detail</button></a></td>
         <td width="200px">{{$ordername}}</td>
          <td> <a data-toggle="modal" data-target="#status{{$canceled->order_id}}" title="Detail"><button class="btn btn-xs btn-dark"><span class="fa fa-file-text-o"></span> Detail</button></a></td>
          <td> <a data-toggle="modal" data-target="#proses{{$canceled->order_id}}" title="Detail"><button class="btn btn-xs btn-dark"><span class="fa fa-file-text-o"></span> Detail</button></a></td>
          <td><div class="row"><div class="col-md-6">{{$canceled->invoice_status}}</div><div class="col-md-6"><a data-toggle="modal" data-target="#pembayaran{{$canceled->order_id}}" title="Detail"><button class="btn btn-xs btn-dark"><span class="fa fa-file-text-o"></span> Detail</button></a></div></div></td>
        <?php $no++; ?>
      </tbody>
        @endforeach
    </table>
    <div class="text-right"><?php echo $canceledorder->links(); ?></div>
  </div>

     @foreach($canceledorder as $canceled)
               <?php
                $detailstatus = DB::table('sys_order_status')
                    ->join('sys_admin','order_status_log_admin_id','=','id')
                    ->where('order_status_order_id',$canceled->order_id)
                    ->get();
               ?>
              <div class="modal fade" id="status{{$canceled->order_id}}" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="false">
                <div class="modal-dialog modal-lg">
                  <div class="modal-content">
                    <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
 
                    <h4 align="center" class="modal-title"> <label style="margin-top:5px; margin-bottom:25px">History proses</label></h4>
                    </div>
                    <div align="left">
                             
                              <div class="row" style="margin-top:10px">
                              <div class="col-md-10 col-md-offset-1">
                              <div style="height:300px;overflow:auto;">
                               <table class="table table-bordered table-hover">
                                <thead>
                                  <tr>
                                    <th>No</th>
                                    <th>Tanggal</th>
                                    <th>Status</th>
                                    <th>Dilakukakn oleh</th>
                                  </tr>
                                </thead>
                                <tbody>
                                <?php 
                                    $no=1; 
                                    $totalfinished = 0;
                                ?>
                                @foreach($detailstatus as $detail)
                                    <td>{{$no}}</td>
                                    <td>{{date("d-M-Y h:i",strtotime($detail->order_status_date))}}</td>
                                    <td>{{$detail->order_status_type}}</td>
                                    <td>{{$detail->admin_name}}</td>
                                </tbody>
                                <?php $no++; ?>
                                @endforeach
                              </table>



                              </div> 
                              </div> 
                              </div>    
                    
                    </div>
                    <div class="modal-footer">

                   <button class="btn btn-sm btn-dark" style="margin-right:5px" class="close" data-dismiss="modal"><span class="fa fa-times"></span> Tutup</button></a>
                         
                    </div>
                  </div>
                </div>
              </div>
              @endforeach

               @foreach($canceledorder as $canceled)
              <?php
                $detailprogress = DB::table('sys_order_progress_log')
                  ->where('order_progress_log_order_id',$canceled->order_id)
                  ->get();
              ?>
              <div class="modal fade" id="proses{{$canceled->order_id}}" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="false">
                <div class="modal-dialog modal-lg">
                  <div class="modal-content">
                    <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
 
                    <h4 align="center" class="modal-title"> <label style="margin-top:5px; margin-bottom:25px">History status</label></h4>
                    </div>
                    <div align="left">
                              
                              <div class="row" style="margin-top:10px">
                              <div class="col-md-10 col-md-offset-1">
                              <div style="height:300px;overflow:auto;">
                               <table class="table table-bordered table-hover">
                                <thead>
                                  <tr>
                                    <th>No</th>
                                    <th>Tanggal</th>
                                    <th>Proses (Qty)</th>
                                    <th>Status</th>
                                  </tr>
                                </thead>
                                <tbody>
                                <?php 
                                    $no=1; 
                                    $totalfinished = 0;
                                ?>
                                @foreach($detailprogress as $detail)
                                    <td>{{$no}}</td>
                                    <td>{{date("d-M-Y h:i",strtotime($detail->order_progress_log_date))}}</td>
                                    <td>{{$detail->order_progress_log_qty}}</td>
                                    <td>{{$detail->order_progress_log_status}}</td>
                                </tbody>
                                <?php $no++; ?>
                                @endforeach
                              </table>



                              </div> 
                              </div> 
                              </div>   
                    
                    </div>
                    <div class="modal-footer">

                    <button class="btn btn-sm btn-dark" style="margin-right:5px" class="close" data-dismiss="modal"><span class="fa fa-times"></span> Tutup</button></a>
                         
                    </div>
                  </div>
                </div>
              </div>
              @endforeach

               @foreach($canceledorder as $canceled)
               <?php 
                $terminI = DB::table('sys_order')
                      ->join('sys_invoice','invoice_order_id','=','order_id')
                      ->join('sys_invoice_detail','invoice_detail_invoice_id','=','invoice_id')
                      ->where('order_id',$canceled->order_id)
                      ->where('invoice_detail_status','Termin I (DP)')
                      ->first();
                if(ISSET($terminI->invoice_detail_payment)=='0'){
                  $termin1 = 0;
                }else if(ISSET($terminI->invoice_detail_payment)<>'0'){
                  $termin1 = $terminI->invoice_detail_payment;
                }
                $terminII = DB::table('sys_order')
                      ->join('sys_invoice','invoice_order_id','=','order_id')
                      ->join('sys_invoice_detail','invoice_detail_invoice_id','=','invoice_id')
                      ->where('order_id',$canceled->order_id)
                      ->where('invoice_detail_status','Termin II')
                      ->first();
                if(ISSET($terminII->invoice_detail_payment)=='0'){
                  $termin2 = 0;
                }else if(ISSET($terminII->invoice_detail_payment)<>'0'){
                  $termin2 = $terminII->invoice_detail_payment;
                }
                $terminIII = DB::table('sys_order')
                      ->join('sys_invoice','invoice_order_id','=','order_id')
                      ->join('sys_invoice_detail','invoice_detail_invoice_id','=','invoice_id')
                      ->where('order_id',$canceled->order_id)
                      ->where('invoice_detail_status','Termin III')
                      ->first();
                if(ISSET($terminIII->invoice_detail_payment)=='0'){
                  $termin3 = 0;
                }else if(ISSET($terminIII->invoice_detail_payment)<>'0'){
                  $termin3 = $$terminIII->invoice_detail_payment;
                }
                $terminIV = DB::table('sys_order')
                      ->join('sys_invoice','invoice_order_id','=','order_id')
                      ->join('sys_invoice_detail','invoice_detail_invoice_id','=','invoice_id')
                      ->where('order_id',$canceled->order_id)
                      ->where('invoice_detail_status','Termin IV')
                      ->first();
                if(ISSET($terminIV->invoice_detail_payment)=='0'){
                  $termin4 = 0;
                }else if(ISSET($terminIV->invoice_detail_payment)<>'0'){
                  $termin4 = $terminIV->invoice_detail_payment;
                }

                $kekurangan = DB::table('sys_order')
                      ->join('sys_invoice','invoice_order_id','=','order_id')
                      ->join('sys_invoice_detail','invoice_detail_invoice_id','=','invoice_id')
                      ->where('order_id',$canceled->order_id)
                      ->sum('invoice_detail_payment');
                $pelunasan = DB::table('sys_order')
                      ->join('sys_invoice','invoice_order_id','=','order_id')
                      ->join('sys_invoice_detail','invoice_detail_invoice_id','=','invoice_id')
                      ->where('order_id',$canceled->order_id)
                      ->where('invoice_detail_status','=','Pelunasan')
                      ->first();
                if(ISSET($pelunasan->invoice_detail_payment)=='0'){
                  $totalpelunasan = 0;
                }else if(ISSET($pelunasan->invoice_detail_payment)<>'0'){
                  $totalpelunasan = $pelunasan->invoice_detail_payment;
                }
                
              
               ?>
              <div class="modal fade" id="pembayaran{{$canceled->order_id}}" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="false">
                <div class="modal-dialog modal-lg">
                  <div class="modal-content">
                    <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
 
                    <h4 align="center" class="modal-title"> <label style="margin-top:5px; margin-bottom:25px">History pembayaran</label></h4>
                    </div>
                    <div align="left">
                             
                              <div class="row" style="margin-top:10px">
                              <div class="col-md-10 col-md-offset-1">

                              

                                  <div class="row">
                                  <div class="col-lg-4">
                                  <label>Total invoice</label>
                                  </div>
                                  <div class="col-lg-4">
                                    <input type="text"  class="form-control" style="width:250px;height:30px" value=" Rp {{number_format($canceled->invoice_total_payment,0,'.','.')}}" disabled /></input>
                                  </div>
                                  </div>
                                  <br>

                                  <div class="row">
                                  <div class="col-lg-4">
                                  <label>Kekurangan</label>
                                  </div>
                                  <div class="col-lg-4">
                                    <input type="text"  class="form-control" style="width:250px;height:30px" value=" Rp {{number_format($canceled->invoice_total_payment-$kekurangan,0,'.','.')}}" disabled /></input>
                                  </div>
                                  </div>
                                  <br>

                            <label><u>Detail pembayaran</u></label>
                            <legend></legend>
                                  <div class="row">
                                  <div class="col-lg-4">
                                  <label>Termin I (DP)</label>
                                  </div>
                                  <div class="col-lg-4">
                                  <input type="text"  class="form-control" style="width:250px;height:30px" value="<?php if($termin1<>0){echo "Rp ".number_format($termin1,0,'.','.');} ?>" disabled ></input>
                                  </div>
                                  </div>
                                  <br>

                                  <div class="row">
                                  <div class="col-lg-4">
                                  <label>Termin II</label>
                                  </div>
                                  <div class="col-lg-4">
                                  <input type="text"  class="form-control" style="width:250px;height:30px" name="termin2" value="<?php if($termin2<>0){echo "Rp ".number_format($termin2,0,'.','.');} ?>"disabled></input>
                                  </div>
                                  </div>
                                  <br>

                                    <div class="row">
                                  <div class="col-lg-4">
                                  <label>Termin III</label>
                                  </div>
                                  <div class="col-lg-4">
                                  <input type="text"  class="form-control" style="width:250px;height:30px" name="termin3" value="<?php if($termin3<>0){echo "Rp ".number_format($termin3,0,'.','.');} ?>" disabled ></input>
                                  </div>
                                  </div>
                                  <br>

                                    <div class="row">
                                  <div class="col-lg-4">
                                  <label>Termin IV</label>
                                  </div>
                                  <div class="col-lg-4">
                                  <input type="text"  class="form-control" style="width:250px;height:30px" name="termin4" value="<?php if($termin4<>0){echo "Rp ".number_format($termin4,0,'.','.');} ?>" disabled ></input>
                                  </div>
                                  </div>
                                  <br>


                                    <div class="row">
                                  <div class="col-lg-4">
                                  <label>Pelunasan </label>
                                  </div>
                                  <div class="col-lg-4">
                                  <input type="text"  class="form-control" style="width:250px;height:30px" name="pelunasan" value="<?php if($totalpelunasan<>0){echo "Rp ".number_format($totalpelunasan,0,'.','.');} ?>" disabled ></input>
                                  </div>
                                  </div>
                                  <br>
                              </div> 
                              </div>   
                    
                    </div>
                    <div class="modal-footer">

                <button class="btn btn-sm btn-dark" style="margin-right:5px" class="close" data-dismiss="modal"><span class="fa fa-times"></span> Tutup</button></a>
                         
                    </div>
                  </div>
                </div>
              </div>
              @endforeach



              @foreach($canceledorder as $orderlist) 


     <?php
        if($orderlist->order_name=='idcard'){
          $type = DB::table('sys_order_idcard')
                    ->where('order_idcard_order_id','=',$orderlist->order_id)
                    ->first();
          $ordername = 'ID Card ('.$type->order_idcard_quality_name.')';
        }
        else if($orderlist->order_name=='packaging'){
          $ordername = 'Packaging';
        }
        else if($orderlist->order_name=='brochure'){
          $type = DB::table('sys_order_brochure')
                        ->where('order_brochure_order_id','=',$orderlist->order_id)
                        ->first();
          if($type->order_brochure_type=="brochure"){
          $ordername = 'Brosur (Brosur)';
          }else if($type->order_brochure_type=="envelope"){
          $ordername = 'Brosur (Amplop)';
          }else if($type->order_brochure_type=="flayer"){
          $ordername = 'Brosur (Flayer)';
          }else if($type->order_brochure_type=="letterhead"){
          $ordername = 'Brosur (Kop Surat)';
          }
        }
        else if($orderlist->order_name=='nota'){
          $type = DB::table('sys_order_bill')
                        ->where('order_bill_order_id','=',$orderlist->order_id)
                        ->first();
          $ordername = $type->order_bill_name;
        }
        else if($orderlist->order_name=='tshirt'){
           $type = DB::table('sys_order_tshirt')
                        ->join('ref_tshirt_detail','tshirt_detail_id','=','order_tshirt_tshirt_id')
                        ->join('ref_tshirt','tshirt_id','=','tshirt_detail_tshirt_id')
                        ->where('order_tshirt_order_id','=',$orderlist->order_id)
                        ->first();
          $ordername = 'T-Shirt ('.$type->tshirt_type_of_material.')';
        }
         ?>
              <div class="modal fade" id="detail{{$orderlist->order_id}}" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="false">
                <div class="modal-dialog modal-lg" style="width:50%">
                  <div class="modal-content">
                    <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
 
                    <h4 align="center" class="modal-title"> <label style="margin-top:5px; margin-bottom:5px">Detail order</label></h4>
                    </div>
                    <div align="left">
                              
                          <div class="row" style="margin-top:5px">
                          <div class="col-md-10 col-md-offset-1">
                            <br>
                            <label>Data pemesan</label>
                            <legend></legend>
                            <div class="row">
                            <div class="col-md-12">
                            <div class="row">
                              <div class="col-md-4">
                                  Nama pemesan
                              </div>
                              <div class="col-md-1">
                              :
                              </div>
                              <div class="col-md-7">
                              <label>{{$orderlist->customer_name}}</label>
                              </div>
                              <br>
                              <br>
                              <div class="col-md-4">
                                  Alamat pemesan
                              </div>
                              <div class="col-md-1">
                              :
                              </div>
                              <div class="col-md-7">
                              <label>{{$orderlist->customer_address}}</label>
                              </div>
                              <br>
                              <br>
                              <div class="col-md-4">
                                  Nomor telepon
                              </div>
                              <div class="col-md-1">
                              :
                              </div>
                              <div class="col-md-7">
                              <label>{{$orderlist->customer_phone}}</label>
                              </div>
                              <br>
                              <br>
                              <div class="col-md-4">
                                  Alamat email
                              </div>
                              <div class="col-md-1">
                              :
                              </div>
                              <div class="col-md-7">
                              <label>{{$orderlist->customer_email}}</label>
                              </div>
                              <br>
                              <br>
                            </div>
                            </div>
                            </div>
                            
                            
                         

                            <br>
                            <label>Data order</label>
                            <legend></legend>
                            <div class="row">
                            <div class="col-md-12">
                            <div class="row">
                              <div class="col-md-4">
                                  Tanggal order
                              </div>
                              <div class="col-md-1">
                              :
                              </div>
                              <div class="col-md-7">
                              <label>{{date("d-M-Y",strtotime($orderlist->order_date))}}</label>
                              </div>
                              <br>
                              <br>
                              <div class="col-md-4">
                                  Tanggal approve
                              </div>
                              <div class="col-md-1">
                              :
                              </div>
                              <div class="col-md-7">
                              <label>{{date("d-M-Y",strtotime($orderlist->order_status_date))}}</label>
                              </div>
                              <br>
                              <br>
                              <div class="col-md-4">
                                  Kode order
                              </div>
                              <div class="col-md-1">
                              :
                              </div>
                              <div class="col-md-7">
                              <label>{{$orderlist->order_code}}</label>
                              </div>
                              <br>
                              <br>
                              <div class="col-md-4">
                                  Jenis order
                              </div>
                              <div class="col-md-1">
                              :
                              </div>
                              <div class="col-md-7">
                              <label>{{$ordername}}</label>
                              </div>
                              <br>
                              <br>
                              <div class="col-md-4">
                                  Harga total (SO/Awal)
                              </div>
                              <div class="col-md-1">
                              :
                              </div>
                              <div class="col-md-7">
                              <label>Rp {{number_format($orderlist->order_total_price,0,'.','.')}}</label>
                              </div>
                              <br>
                              <br>

                              <div class="col-md-4">
                                  Harga total (INV/Fix)
                              </div>
                              <div class="col-md-1">
                              :
                              </div>
                              <div class="col-md-7">
                              <label>Rp {{number_format($orderlist->invoice_total_payment,0,'.','.')}}</label>
                              </div>
                              <br>
                              <br>


                              <div class="col-md-4">
                                  Dibayarkan (INV/Fix)
                              </div>
                              <div class="col-md-1">
                              :
                              </div>
                              <div class="col-md-7">
                                <?php if($orderlist->invoice_detail_payment<>0){
                                  $invoice_detail_payment = $orderlist->invoice_detail_payment;
                                }else{
                                  $invoice_detail_payment = 0;
                                } ?>
                              <label>Rp {{number_format($invoice_detail_payment,0,'.','.')}}</label>
                              </div>
                              <br>
                              <br>


                              <div class="col-md-4">
                                  Status order
                              </div>
                              <div class="col-md-1">
                              :
                              </div>
                              <div class="col-md-7">
                              <label>{{$orderlist->order_status}}</label>
                              </div>
                              <br>
                              <br>
                              <div class="col-md-4">
                                  Jumlah (QTY) order
                              </div>
                              <div class="col-md-1">
                              :
                              </div>
                              <div class="col-md-7">
                              <label>{{$orderlist->order_qty.' '.$orderlist->order_qty_unit}}</label>
                              </div>
                              <br>
                              <br>
                              <div class="col-md-4">
                                  Desain
                              </div>
                              <div class="col-md-1">
                              :
                              </div>
                              <div class="col-md-7">
                               <?php if($orderlist->order_desain<>""){ ?>
                        <a href="{{URL::to($orderlist->order_desain)}}" target="_blank"><button class="btn btn-xs btn-info" style="width:130px"> Lihat dan download</button></a>

                             <?php  }else{ ?> 
                          <button class="btn btn-xs btn-info" style="width:130px" disabled> Tidak ada desain</button>

                             <?php } ?>
                              </div>
                              <br>
                              <br>
                            </div>
                            </div>
                            </div>



      <?php      
        if($orderlist->order_name=='idcard'){
          $type = DB::table('sys_order_idcard')
                    ->where('order_idcard_order_id','=',$orderlist->order_id)
                    ->first();
          $ordername = 'ID Card ('.$type->order_idcard_quality_name.')'; ?>

<label>Detail order</label>
        <legend></legend>
      <div class="row">
      <div class="col-md-12">
      <div class="row">
      <div class="col-md-4">
         Type ID Card
      </div>
      <div class="col-md-1">
      :
      </div>
      <div class="col-md-7">
      <label>{{$type->order_idcard_type_name}}</label>
      </div>
      <br>
      <br>
      <div class="col-md-4">
          Kualitas ID Card
      </div>
      <div class="col-md-1">
      :
      </div>
      <div class="col-md-7">
      <label>{{$type->order_idcard_quality_name}}</label>
      </div>
      <br>
      <br>
      <div class="col-md-4">
          Fitur tambahan
      </div>
      <div class="col-md-1">
      :
      </div>
      <div class="col-md-7">
      <?php $no = 1; 
        $detailorder =  DB::table('sys_order')
            ->join('sys_order_idcard','order_idcard_order_id','=','order_id')
            ->join('sys_order_idcard_detail','order_idcard_detail_order_idcard_id','=','order_idcard_id')
            ->join('ref_additional_features','order_idcard_detail_idcard_additional_features_id','=','additional_features_id')
            ->where('order_id','=',$orderlist->order_id)
            ->get();
      ?>
      @foreach($detailorder as $addfeature)
      <label>{{$no}}. {{$addfeature->additional_features_name}}</label><br>
      <?php $no++; ?>
      @endforeach
      </div>
      <br>
      <br>
      <br>
    </div>
    </div>
    </div>




     <?php   }
        else if($orderlist->order_name=='packaging'){
          $type = DB::table('sys_order_packaging')
                    ->where('order_packaging_order_id','=',$orderlist->order_id)
                    ->first();
          $ordername = 'Packaging ('.$type->order_packaging_type.')'; ?>
 <br>
                            <label>Detail order</label>
                            <legend></legend>
                                <div class="row">
                                <div class="col-md-12">
                                <div class="row">
                                <div class="col-md-4">
                                   Type packaging
                                </div>
                                <div class="col-md-1">
                                :
                                </div>
                                <div class="col-md-7">
                                <label>{{$ordername}}</label>
                                </div>
                                <br>
                                <br>
                                <div class="col-md-4">
                                    Ukuran (Dimensi)
                                </div>
                                <div class="col-md-1">
                                :
                                </div>
                                <div class="col-md-7">
                                <label>{{$type->order_packaging_size}}</label>
                                </div>
                                <br>
                                <br>
                                <div class="col-md-4">
                                    Jenis kertas
                                </div>
                                <div class="col-md-1">
                                :
                                </div>
                                <div class="col-md-7">
                                <label>{{$type->order_packaging_paper}} Cm</label>
                                </div>
                               
                                <br>
                                <br>
                                <br>
                              </div>
                              </div>

                            </div>



       <?php }
        else if($orderlist->order_name=='brochure'){
          $type = DB::table('sys_order_brochure')
                        ->where('order_brochure_order_id','=',$orderlist->order_id)
                        ->first();
          if($type->order_brochure_type=="brochure"){
          $ordername = 'Brosur (Brosur '.$type->order_brochure_color.' '.$type->order_brochure_qty_print_page.')';
          }else if($type->order_brochure_type=="envelope"){
          $ordername = 'Brosur (Amplop '.$type->order_brochure_color.' '.$type->order_brochure_qty_print_page.')';
          }else if($type->order_brochure_type=="flayer"){
          $ordername = 'Brosur (Flayer '.$type->order_brochure_color.' '.$type->order_brochure_qty_print_page.')';
          }else if($type->order_brochure_type=="letterhead"){
          $ordername = 'Brosur (Kop Surat '.$type->order_brochure_color.' '.$type->order_brochure_qty_print_page.')';
          } ?>

           <br>
                            <label>Detail order</label>
                            <legend></legend>
                                <div class="row">
                                <div class="col-md-12">
                                <div class="row">
                                <div class="col-md-4">
                                   Type brochure
                                </div>
                                <div class="col-md-1">
                                :
                                </div>
                                <div class="col-md-7">
                                <label>{{$ordername}}</label>
                                </div>
                                <br>
                                <br>
                                <div class="col-md-4">
                                    Ukuran (Dimensi)
                                </div>
                                <div class="col-md-1">
                                :
                                </div>
                                <div class="col-md-7">
                                <label>{{$type->order_brochure_size}}</label>
                                </div>
                                <br>
                                <br>
                                <div class="col-md-4">
                                    Jenis kertas
                                </div>
                                <div class="col-md-1">
                                :
                                </div>
                                <div class="col-md-7">
                                <label>{{$type->order_brochure_papertype}}</label>
                                </div>
                               
                                <br>
                                <br>
                                <br>
                              </div>
                              </div>

                            </div>


      <?php  }
        else if($orderlist->order_name=='nota'){
          $type = DB::table('sys_order_bill')
                        ->where('order_bill_order_id','=',$orderlist->order_id)
                        ->first();
          $ordername = $type->order_bill_name;?>

    <b id="title"><label>Detail order</label></b>
                            <legend></legend>
                                <div class="row">
                                <div class="col-md-12">
                                <div class="row">
                                <div class="col-md-4">
                                   Type nota
                                </div>
                                <div class="col-md-1">
                                :
                                </div>
                                <div class="col-md-7">
                                <label>{{$ordername}}</label>
                                </div>
                                <br>
                                <br>
                                <div class="col-md-4">
                                    Ukuran (Dimensi)
                                </div>
                                <div class="col-md-1">
                                :
                                </div>
                                <div class="col-md-7">
                                <label>{{$type->order_bill_size}}</label>
                                </div>
                                <br>
                                <br>
                                <div class="col-md-4">
                                    Jenis kertas
                                </div>
                                <div class="col-md-1">
                                :
                                </div>
                                <div class="col-md-7">
                                <label>{{$type->order_bill_papertype}}</label>
                                </div>
                               
                                <br>
                                <br>
                                <br>
                              </div>
                              </div>

                            </div>



        <?php }
        else if($orderlist->order_name=='tshirt'){
           $type = DB::table('sys_order_tshirt')
                        ->join('ref_tshirt_detail','tshirt_detail_id','=','order_tshirt_tshirt_id')
                        ->join('ref_tshirt','tshirt_id','=','tshirt_detail_tshirt_id')
                        ->where('order_tshirt_order_id','=',$orderlist->order_id)
                        ->first();
          $ordername = 'T-Shirt ('.$type->tshirt_type_of_material.')';?>
<label>Detail order</label>
        <legend></legend>
      <div class="row">
      <div class="col-md-12">
      <div class="row">
      <div class="col-md-4">
         Jenis bahan
      </div>
      <div class="col-md-1">
      :
      </div>
      <div class="col-md-7">
      <label>{{$type->tshirt_type_of_material}}</label>
      </div>
      <br>
      <br>
      <div class="col-md-4">
          Fitur tambahan
      </div>
      <div class="col-md-1">
      :
      </div>
      <div class="col-md-7">
      <?php $no = 1; 
        $detailorder =  DB::table('sys_order')
            ->join('sys_order_tshirt','order_tshirt_order_id','=','order_id')
            ->join('sys_order_tshirt_detail','order_tshirt_detail_order_tshirt_id','=','order_tshirt_id')
            ->join('ref_additional_features','order_tshirt_detail_additional_features_id','=','additional_features_id')
            ->where('order_id','=',$orderlist->order_id)
            ->get();
      ?>
      @foreach($detailorder as $addfeature)
      <label>{{$no}}. {{$addfeature->additional_features_name}}</label><br>
      <?php $no++; ?>
      @endforeach
      </div>
      <br>
      <br>
      <br>
    </div>
    </div>
    </div>



       <?php } ?>

                         
                             
                         
                
                    </div>
                    </div>
                    <div class="modal-footer">

                  </a> <button class="btn btn-sm btn-dark" style="margin-right:5px" class="close" data-dismiss="modal"><span class="fa fa-times"></span> Tutup</button></a>
                         
                    </div>
                  </div>
                </div>
              </div>
              </div>
              @endforeach
</div>


@stop
@stop